' This file is part of the SunDLL.  The SunDLL is free software: you can
' redistribute it and/or modify it under the terms of the GNU General Public
' License as published by the Free Software Foundation, version 2.
'
' This program is distributed in the hope that it will be useful, but WITHOUT
' ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
' FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
' details.
'
' You should have received a copy of the GNU General Public License along with
' this program; if not, write to the Free Software Foundation, Inc., 51
' Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'
' Copyright David R. Pratten
Function dSin(ByVal value As Ext ) As Ext
Dim xdSin As Ext
xdSin =  Sin(value * 1.74532925199433d-02)
If Abs(xdSin) < 1e-12 Then xdSin = 0
Function = xdSin
End Function

' --- dCos operates on degrees
Function dCos(ByVal value As Ext ) As Ext
Dim xdCos As Ext
xdCos = Cos(value * 1.74532925199433d-02)
If Abs(xdCos) < 1e-12 Then xdCos = 0
Function = xdCos
End Function

' --- dTan operates on degrees
Function dTan(ByVal value As Ext ) As Ext
Dim xdTan As Ext
xdTan = Tan(value * 1.74532925199433d-02)
If Abs(xdTan) < 1e-12 Then xdTan = 0
Function = xdTan
End Function

' --- dAtan returns degrees
Function dAtan(ByVal value As Ext) As Ext
Function = Atn(value) * 57.2957795130823
End Function
' --- dAsin returns degrees
'From Excel2000 Documentation
'Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
'Inverse Cosine Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

Function dAsin(ByVal value As Ext ) As Ext
Dim xdAsin As Ext
If Abs(value) > (1 - 1e-12) Then
    xdAsin = 90 * Sgn(value)
Else
    xdAsin = dAtan(value / Sqr(1 - value * value))
End If
Function = xdAsin
End Function

' --- dAcos returns Degrees
Function dAcos(ByVal value As Ext ) As Ext
Function = 90 - dAsin(value)
End Function

Function INTPI () As Ext
Function  = 4 * Atn(1)
End Function


'
' ########################
' DEGTORAD ()
' ########################
'
Function DEGTORAD() As Ext
Function = intpi()/180
End Function
'
' ########################
' RADTODEG ()
' ########################
'
Function RADTODEG() As Ext
Function = 180./intpi()
End Function





